package cn.ivicar.oss.quartz;

import cn.ivicar.oss.guice.OssGuiceConfig;
import cn.ivicar.sim.controller.SimWorkerController;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *每日更新流量及每月更新流量
 */
public class SimFlowStatJob implements Job {

    private static transient final Logger LOGGER = LoggerFactory.getLogger(SimFlowStatJob.class);

    private static SimWorkerController simWorkerController =
        OssGuiceConfig.getStaticInjector().getInstance(SimWorkerController.class);

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {

        LOGGER.info("定时任务：SimFlowStatJob开始执行");
        try {
            simWorkerController.updateFlowDailyStat();//每日更新流量
            simWorkerController.updateFlowMonthlyStat();//每月更新流量
            LOGGER.info("定时任务：SimFlowStatJob执行完毕！");
        }catch (Exception e){
            LOGGER.error("定时任务：SimFlowStatJob执行异常！", e);
        }
    }
}
